package com.example.rwq_test.service.impl;

import com.example.rwq_test.aspect.annoAspect.LogAnnotation;
import com.example.rwq_test.bean.LogBack;
import com.example.rwq_test.service.LogBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class LogBackServiceImpl implements LogBackService {

    private Logger logger = LoggerFactory.getLogger(LogBackServiceImpl.class);

    @Override
    @LogAnnotation
    public LogBack getLogBack() {
        logger.warn("produce logback warn!!");
        LogBack logBack = new LogBack(2, "测试logback", "收到并写入日志");
        logger.debug("logback debug: {}", logBack);
        logger.info("logback info: {}", logBack);
        logger.error("logback  error: {}", logBack);
        return logBack;
    }

    @Override
    @LogAnnotation
    public void deleteLogBack() {
        logger.info("deleteLogBack.");
    }
}
